import os, sys
import re
import random

root = ""
with open("config.ini", "r") as f:
	lines = f.read().split()
	for line in lines:
		name, value = line.split('=')
		if name == "root":
			root = value

def get_random_music():
    music_list = [name for name in os.listdir(root) if re.match(".*\.wav", name)]
    selected_music = music_list[random.randint(0,len(music_list)-1)]
    music_name = re.match("(.*)\.wav",selected_music).group(1)
    file_name = root+selected_music
    return file_name,music_name 

if __name__ == "__main__":
    print(get_random_music())